package com.inspur.incubator.data;


import com.inspur.incubator.common.tools.StringUtils;

import java.io.UnsupportedEncodingException;

public class MakerQueryParam {
    private String usercp;
    private String username;
    private String linkman;
    private String userstatus;
    private String usercheck;
    private String usergtype;

    public void setUsergtype(String usergtype) {
        this.usergtype = usergtype;
    }

    public String getUsergtype() {
        return usergtype;
    }

    public String getUsercp() {
        return usercp;
    }

    public String getusercpSQL() {
        return StringUtils.isValid(usercp) ? "%" + usercp + "%" : null;
    }

    public String getUsernameSQL() {
        return StringUtils.isValid(username) ? "%" + username + "%" : null;
    }

    public String getLinkmanSQL() throws UnsupportedEncodingException {
//        String decoded = URLDecoder.decode(URLDecoder.decode(linkman, "utf-8"), "utf-8");
        return StringUtils.isValid(linkman) ? "%" + linkman + "%" : null;
    }

    public String getUserstatusSQL() {
        if (StringUtils.equals(userstatus, "000")) {
            return null;
        }
        if (StringUtils.equals(userstatus, "201")) {
            return "1";
        }
        if (StringUtils.equals(userstatus, "202")) {
            return "0";
        }
        return null;
    }

    public String getUsercheckSQL() {
        if (StringUtils.equals(usercheck, "000")) {
            return null;
        }
        if (StringUtils.equals(usercheck, "301")) {
            return "0";
        }
        if (StringUtils.equals(usercheck, "302")) {
            return "1";
        }
        if (StringUtils.equals(usercheck, "303")) {
            return "2";
        }
        return null;
    }

    public void setUsercp(String usercp) {
        this.usercp = usercp;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getLinkman() {
        return linkman;
    }

    public void setLinkman(String linkman) {
        this.linkman = linkman;
    }

    public String getUserstatus() {
        return userstatus;
    }

    public void setUserstatus(String userstatus) {
        this.userstatus = userstatus;
    }

    public String getUsercheck() {
        return usercheck;
    }

    public void setUsercheck(String usercheck) {
        this.usercheck = usercheck;
    }
}
